﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Data;
using FXSStation.Modules.SharedInfrastructureModule.BusinessClasses.Orders;
using System.Windows.Media;

namespace FXSStation.Modules.SharedInfrastructureModule.Extentions.Converters
{
    public class DataPointBackgroundConverter :IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
                return Binding.DoNothing;
            else
            {
                OrderBase order = (OrderBase)value;
                if (order != null)
                {
                    switch (order.Type)
                    {
                        case OrderType.BuyOrder:
                            return Brushes.Blue;
                        case OrderType.SellOrder:
                            return Brushes.Red;
                        case OrderType.PendingOrder:
                            return Brushes.Orange;
                        case OrderType.Order:
                            return Brushes.Orange;
                        default:
                            return Brushes.Orange;
                    }
                }
                else
                    return Binding.DoNothing;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
